package mybatisTest.ioTest;

import org.apache.ibatis.io.Resources;
import org.junit.Test;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class ResourcesTest {
    @Test
    public void testg() throws IOException {
        InputStream dtdstm = Resources.getResourceAsStream(
                "db.properties");
        OutputStream outputStream=new FileOutputStream("D:\\code\\javaweb\\Java\\src\\main\\java\\mybatisTest\\files\\aa.txt");

        byte[] buffer=new byte[4096];
        int rc=dtdstm.read(buffer);
        while ((rc!=-1)){
            outputStream.write(buffer);
            rc=dtdstm.read(buffer);
        }
        dtdstm.close();
        outputStream.close();
    }
}
